package com.wish.wishsystem_management.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.wishsystem_management.entity.TbBusinessCircle;
import com.wish.wishsystem_management.service.ITbBusinessCircleService;
import dto.systemDto.BusinessCircleDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vo.ResultEntity;

import java.util.List;

/**
 * <p>
 * 商圈 前端控制器
 * </p>
 *
 * @author zhaiwj
 * @since 2021-03-22
 */
@RestController
@RequestMapping("/tbBusinessCircle")
public class TbBusinessCircleController {

    @Autowired
    ITbBusinessCircleService iTbBusinessCircleService;

    /**
     * 商圈列表
     */
    @RequestMapping("/list")
    public ResultEntity findAll(BusinessCircleDto businessCircleDto) {
        PageHelper.startPage(businessCircleDto.getPageNum(), businessCircleDto.getPageSize());
        List<TbBusinessCircle> list = iTbBusinessCircleService.findAll(businessCircleDto);
        PageInfo info = new PageInfo(list);
        System.err.println(info);
        return ResultEntity.ok("200", "列表", info);
    }

    @RequestMapping(value = "/listByCountyId")
    public ResultEntity listByCountyId(String code) {
        List<ITbBusinessCircleService> list = iTbBusinessCircleService.queryList(code);
        return ResultEntity.ok("200", "商圈", list);
    }

}

